tools: x86_energy_perf_policy: Fix "uninitialized variable" warnings at -O2
authorBen Hutchings <ben@decadent.org.uk>
Tue, 11 Sep 2018 01:38:36 +0000 (02:38 +0100)
committerBen Hutchings <ben@decadent.org.uk>
Wed, 19 Jun 2019 22:16:58 +0000 (23:16 +0100)
commit640b276a11bcc802343f70ad3282007d54f643d1
treeff5592adf03cdbfd0c82e44b68e5372f585f3a7a
parent96fcb0788b292c74b5321546280e31e24386299a
tools: x86_energy_perf_policy: Fix "uninitialized variable" warnings at -O2

x86_energy_perf_policy first uses __get_cpuid() to check the maximum
CPUID level and exits if it is too low.  It then assumes that later
calls will succeed (which I think is architecturally guaranteed).  It
also assumes that CPUID works at all (which is not guaranteed on
x86_32).

If optimisations are enabled, gcc warns about potentially
uninitialized variables.  Fix this by adding an exit-on-error after
every call to __get_cpuid() instead of just checking the maximum
level.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Gbp-Pq: Topic bugfix/x86
Gbp-Pq: Name tools-x86_energy_perf_policy-fix-uninitialized-varia.patch
tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c